#pragma once

#include "Block.hpp"
#include "Position.hpp"

const int cellsize = 30;

// 注意，是以左上角为坐标原点，从左往右x增加，从上到下y增加

class JBlock : public Block // J形方块以及他的变形
{
public:
    JBlock()
        : Block(1, cellsize)
    {
        _shapes[0] = {Position(0, 0), Position(1, 0), Position(1, 1), Position(1, 2)};
        _shapes[1] = {Position(0, 1), Position(0, 2), Position(1, 1), Position(2, 1)};
        _shapes[2] = {Position(1, 0), Position(1, 1), Position(1, 2), Position(2, 2)};
        _shapes[3] = {Position(0, 1), Position(1, 1), Position(2, 0), Position(2, 1)};
        move(0, 3); // 3 * _cellsize = 3 * 30 = 90的x轴刷新
    }
};

class OBlock : public Block
{
public:
    OBlock()
        : Block(2, cellsize)
    {
        _shapes[0] = {Position(0, 0), Position(0, 1), Position(1, 0), Position(1, 1)};
        move(0, 3);
    }
};

class IBlock : public Block
{
public:
    IBlock()
        : Block(3, cellsize)
    {
        _shapes[0] = {Position(1, 0), Position(1, 1), Position(1, 2), Position(1, 3)};
        _shapes[1] = {Position(0, 2), Position(1, 2), Position(2, 2), Position(3, 2)};
        _shapes[2] = {Position(2, 0), Position(2, 1), Position(2, 2), Position(2, 3)};
        _shapes[3] = {Position(0, 1), Position(1, 1), Position(2, 1), Position(3, 1)};
        move(0, 3);
    }
};

class SBlock : public Block
{
public:
    SBlock()
        : Block(4, cellsize)
    {
        _shapes[0] = {Position(0, 1), Position(0, 2), Position(1, 0), Position(1, 1)};
        _shapes[1] = {Position(0, 1), Position(1,1), Position(1, 2), Position(2, 2)};
        _shapes[2] = {Position(1, 1), Position(1, 2), Position(2, 0), Position(2, 1)};
        _shapes[3] = {Position(0, 0), Position(1, 0), Position(1, 1), Position(2, 1)};
        move(0, 3);
    }
};

class ZBlock : public Block
{
public:
    ZBlock()
        : Block(5, cellsize)
    {
        _shapes[0] = {Position(0, 0), Position(0, 1), Position(1, 1), Position(1, 2)};
        _shapes[1] = {Position(0, 2), Position(1, 1), Position(1, 2), Position(2, 1)};
        _shapes[2] = {Position(1, 0), Position(1, 1), Position(2, 1), Position(2, 2)};
        _shapes[3] = {Position(0, 1), Position(1, 0), Position(1, 1), Position(2, 0)};
        move(0, 3);
    }
};

class LBlock : public Block
{
public:
    LBlock()
        : Block(6, cellsize)
    {
        _shapes[0] = {Position(0, 2), Position(1, 0), Position(1, 1), Position(1, 2)};
        _shapes[1] = {Position(0, 1), Position(1, 1), Position(2, 1), Position(2, 2)};
        _shapes[2] = {Position(1, 0), Position(1, 1), Position(1, 2), Position(2, 0)};
        _shapes[3] = {Position(0, 0), Position(0, 1), Position(1, 1), Position(2, 1)};
        move(0, 3);
    }
};

class TBlock : public Block
{
public:
    TBlock()
        : Block(7, cellsize)
    {
        _shapes[0] = {Position(0, 1), Position(1, 0), Position(1, 1), Position(1, 2)};
        _shapes[1] = {Position(0, 1), Position(1, 1), Position(1, 2), Position(2, 1)};
        _shapes[2] = {Position(1, 0), Position(1, 1), Position(1, 2), Position(2, 1)};
        _shapes[3] = {Position(0, 1), Position(1, 0), Position(1, 1), Position(2, 1)};
        move(0, 3);
    }
};
